﻿Imports System.Data.SqlClient

Public Class cn_companyinfo
    Inherits System.Web.UI.Page
    Dim objrd As SqlDataReader = Nothing

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim sSQL As String = ""
        Dim cMode, cMajor As String
        Dim objdt As New GetData
        Dim ps As New PreparedStatement(sSQL)
        Dim strErr As String = ""
        Dim comId As String
        comId = Request("cid")
        Dim comInfo As String
        comInfo = ""

        If comId <> Nothing And comId <> "" Then
            ps.addParameter("cid", comId)
            sSQL = "select *  from  merchant where company_id=@cid and active=1"
            ps.strSql = sSQL
            Dim conn As SqlConnection = objdt.getConn()

            objrd = objdt.dr(ps, strErr, conn, objrd)
            If Not objrd.Read() Then
                objdt.closeConn(conn)
                Exit Sub
            End If
            cMode = objrd("company_mode").ToString
            If cMode = "0" Then
                companyMode.Text = "生产型"
            ElseIf cMode = "1" Then
                companyMode.Text = "贸易型"
            ElseIf cMode = "2" Then
                companyMode.Text = "服务型"
            End If
            cMajor = objrd("company_major").ToString
            If cMajor = "0" Then
                companyMajor.Text = "销售"
            ElseIf cMajor = "1" Then
                companyMajor.Text = "采购"
            ElseIf cMajor = "2" Then
                companyMajor.Text = "两者都是"
            End If

            sSQL = "select *  from  merchant_info where company_id=@cid and lang_flag='zh'"
            ps.strSql = sSQL
            objrd = objdt.dr(ps, strErr, conn, objrd)
            If Not objrd.Read() Then
                objdt.closeConn(conn)
                Exit Sub
            End If
            title.InnerHtml += ":" & objrd.Item("company_name")
            companyName1.InnerText = objrd.Item("company_name")
            comInfo = objrd("brief").ToString
            companyInfo.Text = comInfo
            Dim pField, iOEM As String
            companyName.Text = objrd("company_name").ToString
            c_country.Text = objrd("country").ToString
            c_state.Text = objrd("state").ToString
            c_city.Text = objrd("city").ToString
            c_address.Text = objrd("address").ToString
            mainProduct.Text = objrd("product_sell").ToString
            pField = objrd("product_field").ToString
            If objrd("create_date").ToString <> "" Then
                createDate.Text = Year(objrd("create_date")).ToString & "-" & Month(objrd("create_date")).ToString & "-" & Day(objrd("create_date")).ToString
            End If
            legalPerson.Text = objrd("legal_person").ToString
            saleVolume.Text = objrd("sale_volume").ToString
            exportVolume.Text = objrd("export_volume").ToString
            factoryArea.Text = objrd("factory_area").ToString
            capital.Text = objrd("capital").ToString
            employNum.Text = objrd("employnum").ToString
            importVolume.Text = objrd("import_volume").ToString
            iOEM = objrd("isOEM").ToString
            If iOEM = "0" Or iOEM = "" Then
                isOEM.Text = "否"
            Else
                isOEM.Text = "是"
            End If
            companyType.Text = objrd("company_type").ToString
            mainMarket.Text = objrd("main_market").ToString
            mainBrand.Text = objrd("main_brand").ToString
            mainCustomers.Text = objrd("main_customers").ToString
            bank.Text = objrd("bank").ToString
            bankCode.Text = objrd("bank_code").ToString
            companyUrl.Text = objrd("company_url").ToString
            zipcode.Text = objrd("zipcode").ToString
            companyFax.Text = objrd("company_fax").ToString
            ps.addParameter("pField", pField)
            sSQL = "select *  from  Category where Category_ID=@pField and lang_flag='zh'"
            ps.strSql = sSQL
            objrd = objdt.dr(ps, strErr, conn, objrd)
            objrd.Read()
            productField.Text = objrd("Category_Name").ToString
            objdt.closeConn(conn)

        Else
            Response.Redirect("cn_index.aspx")
        End If
    End Sub


End Class